package com.wanglei.rdd.transform

import org.apache.spark.rdd.RDD
import org.apache.spark.{SparkConf, SparkContext}

object Spark06_groupby {

  def main(args: Array[String]): Unit = {

    //
    val conf = new SparkConf().setMaster("local[2]").setAppName("map")
    val sc = new SparkContext(conf)

    // 分组和分区没有必然的关系
    sc.makeRDD(List("hello", "world", "hello", "scala"))
      .groupBy(_.charAt(0))
      .collect()
      .foreach(println)


    //
    sc.stop()

  }

}
